﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace ICSharpCode.TextEditor.Util
{
    public class ColorSolve
    {
        public static Color RepairColor(string name, Color blackColor, ref Color color)
        {
            Color result = color;
            if (blackColor == Color.Black)
            {
                if (name.EndsWith("blue",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#7AC1FF");
                    color = Color.FromArgb(086, 156, 214);
                }
                if (name.EndsWith("0000FF",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#7AC1FF");
                    color = Color.FromArgb(086, 156, 214);
                }

                if (name.EndsWith("green",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#00cc00");
                    color = Color.FromArgb(0, 204, 0);
                }
                if (name.EndsWith("00FF00",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#00cc00");
                    color = Color.FromArgb(0, 204, 0);
                }

                if (name.EndsWith("DarkMagenta",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#cc66ff");
                    color = Color.FromArgb(209, 95, 238);
                }
                if (name.EndsWith("8B008B",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#cc66ff");
                    color = Color.FromArgb(209, 95, 238);
                }

                if (name.EndsWith("Navy",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#cc66ff");
                    color = Color.FromArgb(209, 95, 238);
                }
                if (name.EndsWith("000080",
                    StringComparison.OrdinalIgnoreCase))
                {
                    //color = ParseColor("#cc66ff");
                    color = Color.FromArgb(209, 95, 238);
                }

                if (name.Equals("Black",
                    StringComparison.OrdinalIgnoreCase)||
                    name.Equals("Transparent",
                    StringComparison.OrdinalIgnoreCase))
                {
                    color = Color.FromArgb(220, 220, 220);
                }

            }

            result = color;

            return result;
        }
    }
}
